// 判断是否是微信
let isWechat = (function () {
  let ua = navigator.userAgent.toLowerCase()
  if (ua.match(/MicroMessenger/i)) {
    return true
  } else {
    return false
  }
})()
// 获得地址栏参数
let queryString = (item) => {
  let url = location.search
  let theRequest = {}
  if (url.indexOf('?') !== -1) {
    let str = url.substr(1)
    let strs = str.split('&')
    for (let i = 0; i < strs.length; i++) {
      let obj = strs[i].split('=')
      theRequest[obj[0]] = unescape(obj[1])
    }
  }
  return theRequest[item]
}

export default {
  install (vue) {
    vue.prototype.$helper = {
      isWechat, queryString
    }
  }
}
